Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

356
Visualizações
Unable to log output of "apachectl configtest" to a file

I want to log the output of the command "apachectl configtest" to a file. So I tried the following commands:

root@ubuntu:~# echo $(apachectl -t) >> /tmp/apache_config_check
[Sun Feb 21 14:35:23.614947 2016] [proxy_html:notice] [pid 29249] AH01425: I18n support in mod_proxy_html requires mod_xml2enc. Without it, non-ASCII characters in proxied pages are likely to display incorrectly.
Syntax OK

But It gave empty output:

root@ubuntu:~# cat /tmp/apache_config_check 

root@ubuntu:~# 

I also tried a variation on the command itself:

root@ubuntu:~# apachectl -t >> /tmp/apache_config_check

and a variation on tee:

root@ubuntu:~# $(apachectl -t) | tee /tmp/apache_config_check

Without luck.

I don't really know any other methods to pipe the output, nor I know why the above commands failed. Is it something fundamental?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The problem is that apachectl is sending its output to STDERR instead of STDOUT. So, you need to redirect STDERR as follows:

apachectl -t > /tmp/apache_config_check 2>&1

The 2>&1 is shell-script magic saying "redirect output on file descriptor 2 (STDERR) to file descriptor 1 (STDOUT)".

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda